<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no"/>
    <title>transition过渡动画</title>
    <style>
        [v-cloak] {
            display: none;
        }

        .box {
            width: 100px;
            height: 100px;
            background: #0000FF;
            position: absolute;
            z-index: 1;
            left: 100px;
            top: 35px;
        }

        .fade-enter-active, .fade-leave-active {
            transition: left 1s;
        }

        .fade-enter {
            left: 0px;
        }

        .fade-enter-to {
            left: 100px;
        }

        .fade-leave {
            left: 100px;
        }

        .fade-leave-to {
            left: 0px
        }
    </style>
</head>
<body>
<div id="app" v-cloak></div>
<script src="js/vue.js"></script>
<script>
    let App = {
        template: `
        <div>
        <button type="button" @click="isShow=false">左移</button> <button type="button" @click="isShow=true">右移</button>
        <transition name="fade">
               <div class="box" v-show="isShow"></div>
        </transition>
</div>
      `,
        data() {
            return {
                isShow: false
            }
        }
    };
    new Vue({
        el: "#app",
        template: `
            <App/>
        `,
        components: {
            App
        }
    })
</script>
</body>
</html>
